/**
 * 获得 下发环境变量 url domain
 * @returns {*}
 */
export default function getDomainConf() {

	let getEnv = function(){

		let host = location.host

		if(host.indexOf("dev") > -1){
			return "dev"
		}else if(host.indexOf("beta") > -1){
			return "beta"
		}else if(host.indexOf("wide.feiniu.com") > -1){
			return "online"
		}

	}

	let protocol = window.location.protocol

	let apiDomain = ""

	let env = window.oPublicConfig.env.toLocaleLowerCase() || getEnv()

	switch (env) {
		case "dev":
			return {
				environment: 'dev',
				apiDomain: `${protocol}//storemanager-api.beta1.fn`,
				stDomain: `${protocol}//wide.dev1.fn`,
				cookieDomain: ".dev1.fn"
			}
			break;
		case "beta":
			return {
				environment: 'beta',
				apiDomain: `${protocol}//storemanager-api.beta1.fn`,
				stDomain: `${protocol}//wide.beta1.fn`,
				cookieDomain: ".beta1.fn"
			}
			break;
		case "preview" :
			return {
				environment: 'preview',
				apiDomain: `${protocol}//storemanager-api.idc1.fn`,
				stDomain: `${protocol}//wide.feiniu.com`,
				cookieDomain: ".feiniu.com"
			}
			break;
		case "online" :
			return {
				environment: 'online',
				apiDomain: `${protocol}//storemanager-api.feiniu.com`,
				stDomain: `${protocol}//wide.feiniu.com`,
				cookieDomain: ".feiniu.com"
			}
			break;
	}
}


